package com.queming.core.entity;

import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.util.Date;

/**
 * @author chencidiao
 * @date 2022/04/17 18:45
 * 提供各个实体类共有的字段
 **/
@MappedSuperclass
@Data
public abstract class AbstractEntity {
    @Id
    @GeneratedValue(generator = "Ksuid")
    @GenericGenerator(name = "Ksuid", strategy = "com.queming.core.Utils.KsuidIdentifierGenerator")
    private String id;

    //创建时

    @CreationTimestamp
    private Date createdTime;

    //更新时

    @UpdateTimestamp
    private Date updatedTime;

}
